<?php

namespace App\Entity\Machine;

use ApiPlatform\Core\Annotation\ApiResource;
use App\Base\Annotation\Common;
use App\Base\Annotation\EntityInfo;
use App\Entity\Department;
use App\Repository\Machine\MachineRepository;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups;

/**
 * @EntityInfo(name="Machine",cnName="设备")
 * @ApiResource()
 * @ORM\Entity(repositoryClass=MachineRepository::class)
 */
class Machine
{
    /**
     * @Common(cnName="#",listType="text",editType="text")
     * @ORM\Id()
     * @ORM\GeneratedValue()
     * @ORM\Column(type="integer")
     * @Groups({"machine"})
     */
    private $id;

    /**
     * @Common(cnName="设备编码",listType="text",editType="text",width="150")
     * @ORM\Column(type="string", length=255, nullable=true)
     * @Groups({"machine"})
     */
    private $code;

    /**
     * @Common(cnName="设备名称",listType="text",editType="text",width="")
     * @ORM\Column(type="string", length=255)
     * @Groups({"machine"})
     */
    private $name;

    /**
     * @Common(cnName="设备主图",listType="text",editType="pic")
     * @ORM\Column(type="string", length=255, nullable=true)
     * @Groups({"machine"})
     */
    private $pic;

    /**
     * @Common(cnName="规格型号",listType="text",editType="text",width="150")
     * @ORM\Column(type="string", length=255, nullable=true)
     * @Groups({"machine"})
     */
    private $sn;

    /**
     * @Common(cnName="购买时间",listType="text",editType="datetime")
     * @ORM\Column(type="datetime", nullable=true)
     * @Groups({"machine"})
     */
    private $buyAt;

    /**
     * @Common(cnName="验收时间",listType="text",editType="datetime")
     * @ORM\Column(type="datetime", nullable=true)
     * @Groups({"machine"})
     */
    private $confirmAt;

    /**
     * @Common(cnName="报废日期",listType="text",editType="datetime")
     * @ORM\Column(type="datetime", nullable=true)
     * @Groups({"machine"})
     */
    private $expireAt;

    /**
     * @Common(cnName="使用寿命",listType="text",editType="text")
     * @ORM\Column(type="integer", nullable=true)
     * @Groups({"machine"})
     */
    private $expireDays;

    /**
     * @Common(cnName="资产原值",listType="text",editType="text")
     * @ORM\Column(type="float", nullable=true)
     * @Groups({"machine"})
     */
    private $priceOrigin;

    /**
     * @Common(cnName="资产净值",listType="text",editType="text")
     * @ORM\Column(type="float", nullable=true)
     * @Groups({"machine"})
     */
    private $priceCurrent;

    /**
     * @Common(cnName="设备类型",listType="text",editType="select")
     * @ORM\ManyToOne(targetEntity=MachineCategory::class, inversedBy="Machines")
     * @ORM\JoinColumn(nullable=false)
     * @Groups({"Machine","full"})
     */
    private $category;

    /**
     * @Common(cnName="设备标记",listType="text",editType="radio")
     * @ORM\ManyToOne(targetEntity=MachineGroup::class, inversedBy="machines")
     * @ORM\JoinColumn(nullable=false)
     * @Groups({"machine","full"})
     */
    private $groups;

    /**
     * @Common(cnName="使用状态",listType="text",editType="radio")
     * @ORM\ManyToOne(targetEntity=MachineStatus::class, inversedBy="machines")
     * @ORM\JoinColumn(nullable=false)
     * @Groups({"machine","full"})
     */
    private $status;

    /**
     * @Common(cnName="供应商",listType="text",editType="entity")
     * @ORM\ManyToOne(targetEntity=MachineSupplier::class, inversedBy="machines")
     * @Groups({"machine","full"})
     */
    private $supplier;

    /**
     * @Common(cnName="代理商 ",listType="text",editType="entity")
     * @ORM\ManyToOne(targetEntity=MachineAgent::class, inversedBy="machines")
     * @Groups({"machine","full"})
     */
    private $agent;

    /**
     * @Common(cnName="操作人 ",listType="text",editType="entity")
     * @ORM\ManyToOne(targetEntity=MachineUser::class, inversedBy="machines")
     * @Groups({"machine","full"})
     */
    private $operator;

    /**
     * @Common(cnName="所属部门",listType="text",editType="entity")
     * @ORM\ManyToOne(targetEntity=Department::class)
     * @Groups({"machine","full"})
     */
    private $department;

    /**
     * @Common(cnName="维修班组",listType="text",editType="entity")
     * @ORM\ManyToOne(targetEntity=Department::class)
     * @Groups({"machine","full"})
     */
    private $repairBy;

    public function getId(): ?int
    {
        return $this->id;
    }

    public function getCode(): ?string
    {
        return $this->code;
    }

    public function setCode(?string $code): self
    {
        $this->code = $code;

        return $this;
    }

    public function getName(): ?string
    {
        return $this->name;
    }

    public function setName(string $name): self
    {
        $this->name = $name;

        return $this;
    }

    public function getPic(): ?string
    {
        return $this->pic;
    }

    public function setPic(?string $pic): self
    {
        $this->pic = $pic;

        return $this;
    }

    public function getSn(): ?string
    {
        return $this->sn;
    }

    public function setSn(?string $sn): self
    {
        $this->sn = $sn;

        return $this;
    }

    public function getBuyAt(): ?\DateTimeInterface
    {
        return $this->buyAt;
    }

    public function setBuyAt(?\DateTimeInterface $buyAt): self
    {
        $this->buyAt = $buyAt;

        return $this;
    }

    public function getConfirmAt(): ?\DateTimeInterface
    {
        return $this->confirmAt;
    }

    public function setConfirmAt(?\DateTimeInterface $confirmAt): self
    {
        $this->confirmAt = $confirmAt;

        return $this;
    }

    public function getExpireAt(): ?\DateTimeInterface
    {
        return $this->expireAt;
    }

    public function setExpireAt(?\DateTimeInterface $expireAt): self
    {
        $this->expireAt = $expireAt;

        return $this;
    }

    public function getExpireDays(): ?int
    {
        return $this->expireDays;
    }

    public function setExpireDays(?int $expireDays): self
    {
        $this->expireDays = $expireDays;

        return $this;
    }

    public function getPriceOrigin(): ?float
    {
        return $this->priceOrigin;
    }

    public function setPriceOrigin(?float $priceOrigin): self
    {
        $this->priceOrigin = $priceOrigin;

        return $this;
    }

    public function getPriceCurrent(): ?float
    {
        return $this->priceCurrent;
    }

    public function setPriceCurrent(?float $priceCurrent): self
    {
        $this->priceCurrent = $priceCurrent;

        return $this;
    }

    public function getCategory(): ?MachineCategory
    {
        return $this->category;
    }

    public function setCategory(?MachineCategory $category): self
    {
        $this->category = $category;

        return $this;
    }

    public function getGroups(): ?MachineGroup
    {
        return $this->groups;
    }

    public function setGroups(?MachineGroup $groups): self
    {
        $this->groups = $groups;

        return $this;
    }

    public function getStatus(): ?MachineStatus
    {
        return $this->status;
    }

    public function setStatus(?MachineStatus $status): self
    {
        $this->status = $status;

        return $this;
    }

    public function getSupplier(): ?MachineSupplier
    {
        return $this->supplier;
    }

    public function setSupplier(?MachineSupplier $supplier): self
    {
        $this->supplier = $supplier;

        return $this;
    }

    public function getAgent(): ?MachineAgent
    {
        return $this->agent;
    }

    public function setAgent(?MachineAgent $agent): self
    {
        $this->agent = $agent;

        return $this;
    }

    public function getOperator(): ?MachineUser
    {
        return $this->operator;
    }

    public function setOperator(?MachineUser $operator): self
    {
        $this->operator = $operator;

        return $this;
    }

    public function getDepartment(): ?Department
    {
        return $this->department;
    }

    public function setDepartment(?Department $department): self
    {
        $this->department = $department;

        return $this;
    }

    public function getRepairBy(): ?Department
    {
        return $this->repairBy;
    }

    public function setRepairBy(?Department $repairBy): self
    {
        $this->repairBy = $repairBy;

        return $this;
    }
}
